<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/12/6 0006
  Time: 下午 5:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!--注册对话框-->
<div class="mdui-dialog" id="example-2">
    <div class="mdui-dialog-title">注册用户界面！</div>
    <div class="mdui-dialog-content">
        <div class="mdui-textfield">
            <i class="mdui-icon material-icons">account_circle</i>
            <label class="mdui-textfield-label">User name</label>
            <input class="mdui-textfield-input" id="musername" type="text" placeholder="User name" />
        </div>
        <div class="mdui-textfield">
            <i class="mdui-icon material-icons">lock</i>
            <label class="mdui-textfield-label">Password</label>
            <input class="mdui-textfield-input" id="mpassword" type="text" placeholder="Password" />
        </div>
    </div>
    <div class="mdui-dialog-actions mdui-dialog-actions-stacked">
        <button class="mdui-btn mdui-ripple" mdui-dialog-confirm id="zc">注册</button>
        <button class="mdui-btn mdui-ripple" mdui-dialog-close>取消</button>
    </div>
</div>
<script>
    var $$ = mdui.JQ;
    $$('#zc').on('click',function (e) {
        var a = $$('#musername').prop('value');
        addUser($$('#musername').prop('value'),$$('#mpassword').prop('value'));
    });
    function  addUser(username,password) {
        var json1 = {
            "conid":2,
            "user":{
                "username":username,
                "password":password
            }
        };
        if(username == '' || password== ''){
            alert('error');
        }else{
            $$.ajax({
                method: 'POST',
                url:'${pageContext.request.contextPath }/menu/userController',
                dataType:"json",
                contentType: "application/json",
                data:JSON.stringify(json1),
                success:function (data, textStatus, xhr){
                    log(data.code + ':' + data.message);
                },
                error:function (xhr,textStatus) {

                }
            });
        }
    }
</script>



